package ${servicePackage}.impl;

import ${baseServiceImplName};
import com.liaoyifan.core.model.Page;
import ${converterPackage}.${converterName};
import ${dtoPackage}.${dtoName};
import ${entityPackage}.${entityName};
import ${mapperPackage}.${mapperName};
import ${queryPackage}.${queryName};
import ${servicePackage}.${serviceName};
import ${voPackage}.${voName};
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * ${tableComment}
 *
 * @author ${author}
 * @since ${since}
 */
@Service
public class ${serviceName}Impl extends ${baseServiceImplSimpleName}<${entityName}, ${mapperName}, ${dtoName}, ${converterName}>
        implements ${serviceName} {

    @Override
    public Page<${voName}> page(${queryName} query) {
        return Page.of(
                query, () -> super.mapper.pageList(query), () -> super.mapper.pageCount(query));
    }

    @Transactional
    @Override
    public void insert(${dtoName} param) {
        super.mapper.insert(super.converter.convert(param));
    }

    @Transactional
    @Override
    public void update(${dtoName} param) {
        super.mapper.update(super.converter.convert(param));
    }

    @Transactional
    @Override
    public void delete(${dtoName} param) {
        super.mapper.deleteById(param.getId());
    }
}
